home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1997 February / macformat-047.iso / Shareware Plus / Developers / The Gray Council 1.2.1 / source / PowerPlant / GrayCouncilPP.h < prev   
Encoding:
Text File  |  1996-11-07  |  48.1 KB  |  1,617 lines  |  [TEXT/CWIE]

  1. //
  2. // The Gray Council PowerPlant Adapter
  3. // Copyright ©1996 by Trygve Isaacson. All Rights Reserved.
  4. //
  5. // PowerPlant adapter classes for The Gray Council.
  6. //
  7. // Before using any of the Gray Council source code, read and
  8. // follow the licensing info in the accompanying documentation
  9. // or contact:
  10. //   <trygve@bombaydigital.com>
  11. //   <http://www.bombaydigital.com>
  12. //
  13. // Also check the web site above to make sure you have the latest version!
  14. //
  15. // The Gray Council provides a set of standard C++ classes that implement
  16. // the standard Apple Grayscale Appearance. The core classes do not
  17. // require any other code such as a particular class framework.
  18. //
  19. // This file defines a set of helper classes that derive from standard
  20. // PowerPlant classes, and interface with the core Gray Council code.
  21. // There are also a couple of attachment subclasses for attaching to
  22. // other pane classes to get a white background and 3D frame.
  23. //
  24. // Normally, to use a Gray Council PowerPlant class, you can simply change the
  25. // class ID of the pane in your Constructor window resource to the
  26. // class ID of the appropriate Gray Council PowerPlant adapter class. For
  27. // example, to use the GC pushbutton, create a normal LButton pane,
  28. // and set its class ID to 'GCpb'. Voila. This also works for the LAttachment
  29. // subclasses defined here.
  30. //
  31. // A couple of the classes use the mUserCon field of the subview to specify
  32. // additional information such as icon IDs, string resource IDs, etc.
  33. //
  34. // If the mUserCon usage conflicts with what you are already doing with it,
  35. // you can use the "extended" pane subclasses (those whose class name ends
  36. // in "PPX" instead of "PP"). These classes read their additional info from
  37. // the pane resource stream instead of using mUserCon. In some cases they
  38. // let you specify additional options in the pane resource that you would
  39. // otherwise have to specify programmatically. The supplied resource file
  40. // named GCCustomPanes.rsrc contains the 'CPPb' custom pane types.
  41. // If you put this file in the Constructor app's folder, or keep it open
  42. // whenever your pane resource file is open, or paste the custom pane
  43. // types into your pane resource file, you can use the extended pane classes
  44. // in Constructor.
  45. //
  46. // Each class here that interfaces to a core AGAObject has a public
  47. // member variable called mAGAObject that points to the actual AGAObject
  48. // subclass object. Certain extended object settings (such as mixed-state
  49. // buttons, proportional and live scrolling, etc.) require you to call
  50. // the AGAObject to set it. The member variable is made public to keep
  51. // these PowerPlant classes as lightweight as possible; you make the call,
  52. // rather than using myriad new functions of the PowerPlant AGA subclasses.
  53. //
  54. // Classes defined below:
  55. //    AGAWindowPP -- LWindow subclass that draws a gray background, with the
  56. //        background type depending on the LWindow windAttr_Modal flag.
  57. //    AGAWindowPPX -- AGAWindowPP (LWindow) subclass, that uses extended
  58. //        CPPb data to determine the background type.
  59. //    AGADialogBoxPP -- LDialogBox subclass that draws a gray background, with
  60. //        the background type depending on the WDEF procID and the LWindow
  61. //        windAttr_Modal flag, and replaces the PowerPlant default button outline
  62. //        by altering the style of the default button AGAPushButton object.
  63. //    AGAWindowPPX -- AGADialogBoxPP (LDialogBox) subclass, that uses extended
  64. //        CPPb data to determine the background type.
  65. //    AGAPushButtonPP -- LStdButton subclass for AGAPushButton.
  66. //    AGACheckBoxPP -- LStdCheckBox subclass for AGACheckBox.
  67. //    AGARadioButtonPP -- LStdRadioButton subclass for AGARadioButton.
  68. //    AGAIconPushButtonPP -- AGAPushButtonPP (LStdButton) subclass for
  69. //        AGAIconPushButton.
  70. //    AGAIconPushButtonPPX -- AGAIconPushButtonPP (LStdButton) subclass for
  71. //        AGAIconPushButton, that uses extended CPPb data for the icon ID.
  72. //    AGAIconCheckBoxPP -- AGACheckBoxPP (LStdCheckBox) subclass for
  73. //        AGAIconCheckBox.
  74. //    AGAIconCheckBoxPPX -- AGAIconCheckBoxPP (LStdCheckBox) subclass for
  75. //        AGAIconCheckBox, that uses extended CPPb data for the icon IDs.
  76. //    AGAIconRadioButtonPP -- AGARadioButtonPP (LStdRadioButton) subclass
  77. //        for AGAIconRadioButton.
  78. //    AGAIconRadioButtonPPX -- AGAIconRadioButtonPP (LStdRadioButton) subclass
  79. //        for AGAIconRadioButton, that uses extended CPPb data for the icon IDs.
  80. //    AGAGroupBoxPP -- LGroupBox subclass for AGAGroupBox, with primary group
  81. //        box appearance.
  82. //    AGAGroupBoxPPX -- AGAGroupBoxPP (LGroupBox) subclass for AGAGroupBox,
  83. //        that uses extended CPPb data for the box type and gap pane ID.
  84. //    AGASecondaryGroupBoxPP -- AGAGroupBoxPP (LGroupBox) subclass for
  85. //        AGAGroupBox, with secondary group box appearance.
  86. //    AGAScrollBarPP -- LStdControl subclass for AGAScrollBar.
  87. //    AGAScrollerPP -- LScroller subclass that replaces the normal LStdControl
  88. //        scroll bars with ones of class AGAScrollBarPP, and correctly
  89. //        maintain them during scrolling.
  90. //    AGAActiveScrollerPP -- LActiveScroller replacement; actually an AGAScrollerPP
  91. //        subclass that sets the AGA scroll bars for live scrolling.
  92. //    AGASliderPP -- LControl subclass for AGASlider.
  93. //    AGASliderPPX -- AGASliderPP (LControl) subclass for AGASlider, that
  94. //        uses extended CPPb data for the label strings ID, style, and
  95. //        slider justification.
  96. //    AGALittleArrowsPP -- LControl subclass for AGALittleArrows.
  97. //    AGALittleArrowsPPX -- AGALittleArrowsPP (LControl) subclass for
  98. //        AGALittleArrows, that uses extended CPPb data for the linked
  99. //        numeric LEditField pane ID.
  100. //    AGAPopupMenuPP -- LStdPopupMenu subclass for AGAPopupMenu.
  101. //    AGADisclosureTrianglePP -- LControl subclass for AGADisclosureTriangle.
  102. //    AGAProgressIndicatorPP -- LControl subclass for AGAProgressIndicator.
  103. //    AGAWhiteBackgroundAttachmentPP -- LAttachment subclass that draws a
  104. //        white background for the pane to which it is attached.
  105. //    AGANotchedWhiteBackgroundAttachmentPP -- AGAWhiteBackgroundAttachmentPP (LAttachment)
  106. //        subclass that avoids painting the "notch" at the bottom right.
  107. //    AGABorderFrameAttachmentPP -- LAttachment subclass that draws a
  108. //        "3D" sunken frame around the pane to which it is attached.
  109. //    AGANotchedBorderFrameAttachmentPP -- AGABorderFrameAttachmentPP (LAttachment)
  110. //        subclass that accounts for the "notch" at the bottom right.
  111. //    AGAEditFieldPP -- LEditField subclass that automatically attaches an
  112. //        AGAWhiteBackgroundAttachmentPP and an AGABorderFrameAttachmentPP,
  113. //        and also knows how to draw the frame in disabled gray when disabled.
  114. //    AGATextEditPP -- LTextEdit subclass that automatically attaches an
  115. //        AGAWhiteBackgroundAttachmentPP and an AGABorderFrameAttachmentPP.
  116. //    AGASeparatorPP -- LPane subclass for AGASeparator.
  117. //    AGACaptionPP -- LCaption subclass for AGAStaticText.
  118. //    AGAListBoxPP -- LListBox subclass that automatically attaches an
  119. //        AGAWhiteBackgroundAttachmentPP and an AGABorderFrameAttachmentPP,
  120. //        and also replaces the normal LFocusBox with an AGAFocusBoxPP so
  121. //        that the focus frame appears correct.
  122. //    AGANotchedListBoxPP -- AGAListBoxPP (LListBox) subclass that uses an
  123. //        AGANotchedWhiteBackgroundAttachmentPP instead of an AGAWhiteBackgroundAttachmentPP.
  124. //    AGANotchedFocusListBoxPP -- AGANotchedListBoxPP (LListBox) subclass that
  125. //        uses both an AGANotchedWhiteBackgroundAttachmentPP instead of an
  126. //        AGAWhiteBackgroundAttachmentPP, and an AGANotchedFocusBoxPP instead of
  127. //        an AGAFocusBoxPP.
  128. //    AGAFocusBoxPP -- LFocusBox subclass used by AGAListBox to draw the
  129. //        list box focus frame.
  130. //    AGANotchedFocusBoxPP -- AGAFocusBoxPP (LFocusBox) subclass that draws the
  131. //        focus box fitted to the "notch" in the bottom right corner.
  132. //    AGAPanelEnclosurePP -- LView+LCommander subclass, used by AGATabPanelPP to
  133. //        handle target activation/deactivation between targets inside panels.
  134. //    AGATabPanelPP -- LView subclass for AGATabPanel, set for standard large
  135. //        tab format using the system font.
  136. //    AGATabPanelPPX -- AGATabPanelPP (LView) subclass for AGATabPanel, that
  137. //        uses extended CPPb data for the label strings ID, and text traits ID.
  138. //        The font size of the text traits resource determines whether the tabs
  139. //        are small or large format.
  140. //    AGASmallTabPanelPP -- AGATabPanelPP (LView) subclass for AGATabPanel, set
  141. //        for standard small tab format using Geneva 10 bold.
  142. //
  143.  
  144. #pragma once
  145.  
  146. #ifndef __GRAYCOUNCILPP__
  147. #define __GRAYCOUNCILPP__
  148.  
  149. #include <LAttachment.h>
  150. #include <LCaption.h>
  151. #include <LControl.h>
  152. #include <LDialogBox.h>
  153. #include <LEditField.h>
  154. #include <LFocusBox.h>
  155. #include <LGroupBox.h>
  156. #include <LListBox.h>
  157. #include <LScroller.h>
  158. #include <LStdControl.h>
  159. #include <LStream.h>
  160. #include <LTextEdit.h>
  161. #include <LWindow.h>
  162. #include <UDrawingState.h>
  163. #include <URegistrar.h>
  164. #include <UTextTraits.h>
  165.  
  166. #include "GrayCouncil.h"
  167.  
  168. //
  169. // You must call InitGrayCouncilPP after initializing PowerPlant and the
  170. // Toolbox and before instantiating any GrayCouncil objects. This routine
  171. // registers the PowerPlant classes and then calls the core InitGrayCouncil
  172. // function for you. If it returns an error, you should quit. The only
  173. // current error situation of this is an out-of-memory condition
  174. // during initialization.
  175. // Alternatively, you can manually register just the adapter classes that
  176. // you will use, and then call InitGrayCouncil.
  177. //
  178.  
  179. extern OSErr InitGrayCouncilPP();
  180.  
  181. #pragma mark AGAWindowPP
  182.  
  183. //
  184. // AGAWindowPP ----------------------------------------------------
  185. //
  186. // LWindow replacement subclass.
  187. // Makes sure the background is painted gray.
  188. // Knows how to shade around the grow box.
  189. //
  190.  
  191. class AGAWindowPP : public LWindow
  192.     {
  193.     public:
  194.  
  195.         AGAWindowPP(LStream* inStream);
  196.         virtual ~AGAWindowPP();
  197.         
  198.         enum { class_ID = 'GCwn' };
  199.         static AGAWindowPP*    CreateStream(LStream* inStream);
  200.  
  201.         // PowerPlant overrides
  202.         virtual void    FinishCreate();
  203.         virtual void    DrawSelf();
  204.         virtual void    ResizeFrameBy(Int16 inWidthDelta, Int16 inHeightDelta, Boolean inRefresh);
  205.  
  206.     protected:
  207.  
  208.         // PowerPlant overrides
  209.         virtual void    FinishCreateSelf();
  210.         virtual void    ActivateSelf();
  211.         virtual void    DeactivateSelf();
  212.         
  213.         virtual void    DrawBackground(const Rect* area, Boolean fill, Boolean active);
  214.         virtual void    InvalidateEdges(Boolean before, Int16 inWidthDelta, Int16 inHeightDelta);
  215.  
  216.         AGABackgroundKind    mBackgroundKind;
  217.     };
  218.  
  219. #pragma mark AGAWindowPPX
  220.  
  221. //
  222. // AGAWindowPPX ----------------------------------------------------
  223. //
  224. // Extended AGAWindowPP class for use with custom pane template.
  225. // The background kind is read from the stream rather than determined
  226. // by checking the window's "modal" attribute.
  227. //
  228.  
  229. class AGAWindowPPX : public AGAWindowPP
  230.     {
  231.     public:
  232.  
  233.         AGAWindowPPX(LStream* inStream);
  234.         virtual ~AGAWindowPPX();
  235.         
  236.         enum { class_ID = 'GXwn' };
  237.         static AGAWindowPPX*    CreateStream(LStream* inStream);
  238.     };
  239.  
  240. #pragma mark AGADialogBoxPP
  241.  
  242. //
  243. // AGADialogBoxPP ----------------------------------------------------
  244. //
  245. // LDialogBox replacement subclass.
  246. // Makes sure the background is painted gray and the default
  247. // button is drawn with an AGA-style default outline.
  248. // Knows how to shade around the grow box.
  249. //
  250.  
  251. class AGADialogBoxPP : public LDialogBox
  252.     {
  253.     public:
  254.  
  255.         AGADialogBoxPP(LStream* inStream);
  256.         virtual ~AGADialogBoxPP();
  257.         
  258.         enum { class_ID = 'GCdb' };
  259.         static AGADialogBoxPP*    CreateStream(LStream* inStream);
  260.  
  261.         // PowerPlant overrides
  262.         virtual void    FinishCreate();
  263.         virtual void    SetDefaultButton(PaneIDT inButtonID);
  264.         virtual void    DrawSelf();
  265.         virtual void    ResizeFrameBy(Int16 inWidthDelta, Int16 inHeightDelta, Boolean inRefresh);
  266.  
  267.     protected:
  268.  
  269.         // PowerPlant overrides
  270.         virtual void    FinishCreateSelf();
  271.         virtual void    ActivateSelf();
  272.         virtual void    DeactivateSelf();
  273.         
  274.         virtual void    DrawBackground(const Rect* area, Boolean fill, Boolean active);
  275.         virtual void    InvalidateEdges(Boolean before, Int16 inWidthDelta, Int16 inHeightDelta);
  276.  
  277.         Boolean                mDeleteDefaultOutline;
  278.         AGABackgroundKind    mBackgroundKind;
  279.     };
  280.  
  281. #pragma mark AGADialogBoxPPX
  282.  
  283. //
  284. // AGADialogBoxPPX ----------------------------------------------------
  285. //
  286. // Extended AGADialogBoxPP class for use with custom pane template.
  287. // The background kind is read from the stream rather than determined
  288. // by peeking at the WIND resource.
  289. //
  290.  
  291. class AGADialogBoxPPX : public AGADialogBoxPP
  292.     {
  293.     public:
  294.  
  295.         AGADialogBoxPPX(LStream* inStream);
  296.         virtual ~AGADialogBoxPPX();
  297.         
  298.         enum { class_ID = 'GXdb' };
  299.         static AGADialogBoxPPX*    CreateStream(LStream* inStream);
  300.     };
  301.  
  302. #pragma mark AGAPushButtonPP
  303.  
  304. //
  305. // AGAPushButtonPP ----------------------------------------------------
  306. //
  307. // LStdButton replacement subclass.
  308. //
  309.  
  310. class AGAPushButtonPP : public LStdButton
  311.     {
  312.     public:
  313.  
  314.         AGAPushButtonPP();
  315.         AGAPushButtonPP(LStream* inStream);
  316.         virtual ~AGAPushButtonPP();
  317.         
  318.         AGAPushButton*    mAGAObject;
  319.  
  320.         enum { class_ID = 'GCpb' };
  321.         static AGAPushButtonPP*    CreateStream(LStream* inStream);
  322.  
  323.         // PowerPlant overrides
  324.         virtual void    SetDescriptor(ConstStringPtr inDescriptor);
  325.         virtual void    ResizeFrameBy(Int16 inWidthDelta, Int16 inHeightDelta, Boolean inRefresh);
  326.         virtual void    MoveBy(Int32 inHorizDelta, Int32 inVertDelta, Boolean inRefresh);
  327.  
  328.     protected:
  329.  
  330.         // PowerPlant overrides
  331.         virtual void    FinishCreateSelf();
  332.         virtual void    DrawSelf();
  333.         virtual void    ClickSelf(const SMouseDownEvent    &inMouseDown);
  334.         virtual void    HotSpotAction(SInt16 inHotSpot, Boolean inCurrInside, Boolean inPrevInside);
  335.         virtual void    EnableSelf();
  336.         virtual void    DisableSelf();
  337.         virtual void    ShowSelf();
  338.  
  339.         virtual void    CreateAGAObject();
  340.     };
  341.  
  342. #pragma mark AGACheckBoxPP
  343.  
  344. //
  345. // AGACheckBoxPP ----------------------------------------------------
  346. //
  347. // LStdCheckBox replacement subclass. To use mixed-state capability,
  348. // set/get the AGACheckBox state directly.
  349. //
  350.  
  351. class AGACheckBoxPP : public LStdCheckBox
  352.     {
  353.     public:
  354.  
  355.         AGACheckBoxPP();
  356.         AGACheckBoxPP(LStream* inStream);
  357.         virtual ~AGACheckBoxPP();
  358.         
  359.         AGACheckBox*    mAGAObject;
  360.  
  361.         enum { class_ID = 'GCcb' };
  362.         static AGACheckBoxPP*    CreateStream(LStream* inStream);
  363.  
  364.         // PowerPlant overrides
  365.         virtual void    SetDescriptor(ConstStringPtr inDescriptor);
  366.         virtual void    ResizeFrameBy(Int16 inWidthDelta, Int16 inHeightDelta, Boolean inRefresh);
  367.         virtual void    MoveBy(Int32 inHorizDelta, Int32 inVertDelta, Boolean inRefresh);
  368.         virtual void    SetValue(SInt32 inValue);
  369.  
  370.     protected:
  371.  
  372.         // PowerPlant overrides
  373.         virtual void    FinishCreateSelf();
  374.         virtual void    DrawSelf();
  375.         virtual void    ClickSelf(const SMouseDownEvent    &inMouseDown);
  376.         virtual void    HotSpotAction(SInt16 inHotSpot, Boolean inCurrInside, Boolean inPrevInside);
  377.         virtual void    EnableSelf();
  378.         virtual void    DisableSelf();
  379.         virtual void    ShowSelf();
  380.  
  381.         virtual void    CreateAGAObject();
  382.     };
  383.  
  384. #pragma mark AGARadioButtonPP
  385.  
  386. //
  387. // AGARadioButtonPP ----------------------------------------------------
  388. //
  389. // LStdRadioButton replacement subclass. To use mixed-state capability,
  390. // set/get the AGARadioButton state directly.
  391. //
  392.  
  393. class AGARadioButtonPP : public LStdRadioButton
  394.     {
  395.     public:
  396.  
  397.         AGARadioButtonPP();
  398.         AGARadioButtonPP(LStream* inStream);
  399.         virtual ~AGARadioButtonPP();
  400.         
  401.         AGARadioButton*    mAGAObject;
  402.  
  403.         enum { class_ID = 'GCrb' };
  404.         static AGARadioButtonPP*    CreateStream(LStream* inStream);
  405.  
  406.         // PowerPlant overrides
  407.         virtual void    SetDescriptor(ConstStringPtr inDescriptor);
  408.         virtual void    ResizeFrameBy(Int16 inWidthDelta, Int16 inHeightDelta, Boolean inRefresh);
  409.         virtual void    MoveBy(Int32 inHorizDelta, Int32 inVertDelta, Boolean inRefresh);
  410.         virtual void    SetValue(SInt32 inValue);
  411.  
  412.     protected:
  413.  
  414.         // PowerPlant overrides
  415.         virtual void    FinishCreateSelf();
  416.         virtual void    DrawSelf();
  417.         virtual void    ClickSelf(const SMouseDownEvent    &inMouseDown);
  418.         virtual void    HotSpotAction(SInt16 inHotSpot, Boolean inCurrInside, Boolean inPrevInside);
  419.         virtual void    EnableSelf();
  420.         virtual void    DisableSelf();
  421.         virtual void    ShowSelf();
  422.  
  423.         virtual void    CreateAGAObject();
  424.     };
  425.  
  426. #pragma mark AGAIconPushButtonPP
  427.  
  428. //
  429. // AGAIconPushButtonPP ----------------------------------------------------
  430. //
  431. // LStdButton replacement subclass that implements an icon button that behaves
  432. // like an LStdButton -- you click it does its HotSpotResult. The mUserCon is
  433. // used to obtain the button's icon ID. You can also set the icon ID of the
  434. // AGAIconPushButton directly (cast the mAGAObject to AGAIconPushButton*).
  435. //
  436.  
  437. class AGAIconPushButtonPP : public AGAPushButtonPP
  438.     {
  439.     public:
  440.  
  441.         AGAIconPushButtonPP();
  442.         AGAIconPushButtonPP(LStream* inStream);
  443.         virtual ~AGAIconPushButtonPP();
  444.         
  445.         enum { class_ID = 'GCip' };
  446.         static AGAIconPushButtonPP*    CreateStream(LStream* inStream);
  447.  
  448.     protected:
  449.  
  450.         virtual void    CreateAGAObject();
  451.         
  452.         // Extra AGA object initialization values
  453.         SInt16            mIconID;
  454.  
  455.         MIconButtonObject::ButtonFrameType    mFrameType;
  456.         MIconButtonObject::ButtonImageType    mImageType;
  457.     };
  458.  
  459. #pragma mark AGAIconPushButtonPPX
  460.  
  461. //
  462. // AGAIconPushButtonPPX ----------------------------------------------------
  463. //
  464. // Extended AGAIconPushButtonPP class for use with custom pane template.
  465. // The icon ID is read from the stream.
  466. //
  467.  
  468. class AGAIconPushButtonPPX : public AGAIconPushButtonPP
  469.     {
  470.     public:
  471.  
  472.         AGAIconPushButtonPPX(LStream* inStream);
  473.         virtual ~AGAIconPushButtonPPX();
  474.         
  475.         enum { class_ID = 'GXip' };
  476.         static AGAIconPushButtonPPX*    CreateStream(LStream* inStream);
  477.     };
  478.  
  479. #pragma mark AGAIconCheckBoxPP
  480.  
  481. //
  482. // AGAIconCheckBoxPP ----------------------------------------------------
  483. //
  484. // LStdCheckBox replacement subclass that implements an icon button that behaves
  485. // like a check box -- you click it and it toggles its on/off state. The mUserCon
  486. // is used to obtain the button's icon ID. You can also set the icon ID of the
  487. // AGAIconCheckBox directly (cast the mAGAObject to AGAIconCheckBox*). If you want
  488. // the on/off states to have different icons, you can specify different icon IDs.
  489. //
  490.  
  491. class AGAIconCheckBoxPP : public AGACheckBoxPP
  492.     {
  493.     public:
  494.  
  495.         AGAIconCheckBoxPP();
  496.         AGAIconCheckBoxPP(LStream* inStream);
  497.         virtual ~AGAIconCheckBoxPP();
  498.         
  499.         enum { class_ID = 'GCic' };
  500.         static AGAIconCheckBoxPP*    CreateStream(LStream* inStream);
  501.  
  502.     protected:
  503.  
  504.         virtual void    CreateAGAObject();
  505.         
  506.         // Extra AGA object initialization values
  507.         SInt16            mOffIconID;
  508.         SInt16            mOnIconID;
  509.  
  510.         MIconButtonObject::ButtonFrameType    mFrameType;
  511.         MIconButtonObject::ButtonImageType    mImageType;
  512.     };
  513.  
  514. #pragma mark AGAIconCheckBoxPPX
  515.  
  516. //
  517. // AGAIconCheckBoxPPX ----------------------------------------------------
  518. //
  519. // Extended AGAIconCheckBoxPP class for use with custom pane template.
  520. // The off and on icon IDs are read from the stream.
  521. //
  522.  
  523. class AGAIconCheckBoxPPX : public AGAIconCheckBoxPP
  524.     {
  525.     public:
  526.  
  527.         AGAIconCheckBoxPPX(LStream* inStream);
  528.         virtual ~AGAIconCheckBoxPPX();
  529.         
  530.         enum { class_ID = 'GXic' };
  531.         static AGAIconCheckBoxPPX*    CreateStream(LStream* inStream);
  532.     };
  533.  
  534. #pragma mark AGAIconRadioButtonPP
  535.  
  536. //
  537. // AGAIconRadioButtonPP ----------------------------------------------------
  538. //
  539. // LStdRadioButton replacement subclass that implements an icon button that behaves
  540. // like a radio button -- you click it and it turns on, and the others in its
  541. // tab group are turned off. The mUserCon is used to obtain the
  542. // button's icon ID. You can also set the icon ID of the AGAIconRadioButton
  543. // directly (cast the mAGAObject to AGAIconRadioButton*). If you want the on/off
  544. // states to have different icons, you can specify different icon IDs.
  545. //
  546.  
  547. class AGAIconRadioButtonPP : public AGARadioButtonPP
  548.     {
  549.     public:
  550.  
  551.         AGAIconRadioButtonPP();
  552.         AGAIconRadioButtonPP(LStream* inStream);
  553.         virtual ~AGAIconRadioButtonPP();
  554.         
  555.         enum { class_ID = 'GCir' };
  556.         static AGAIconRadioButtonPP*    CreateStream(LStream* inStream);
  557.  
  558.     protected:
  559.  
  560.         virtual void    CreateAGAObject();
  561.         
  562.         // Extra AGA object initialization values
  563.         SInt16            mOffIconID;
  564.         SInt16            mOnIconID;
  565.  
  566.         MIconButtonObject::ButtonFrameType    mFrameType;
  567.         MIconButtonObject::ButtonImageType    mImageType;
  568.     };
  569.  
  570. #pragma mark AGAIconRadioButtonPPX
  571.  
  572. //
  573. // AGAIconRadioButtonPPX ----------------------------------------------------
  574. //
  575. // Extended AGAIconRadioButtonPP class for use with custom pane template.
  576. // The off and on icon IDs are read from the stream.
  577. //
  578.  
  579. class AGAIconRadioButtonPPX : public AGAIconRadioButtonPP
  580.     {
  581.     public:
  582.  
  583.         AGAIconRadioButtonPPX(LStream* inStream);
  584.         virtual ~AGAIconRadioButtonPPX();
  585.         
  586.         enum { class_ID = 'GXir' };
  587.         static AGAIconRadioButtonPPX*    CreateStream(LStream* inStream);
  588.     };
  589.  
  590. #pragma mark AGAGroupBoxPP
  591.  
  592. //
  593. // AGAGroupBoxPP ----------------------------------------------------
  594. //
  595. // LGroupBox replacement subclass. Defaults to primary group box type.
  596. //
  597.  
  598. class AGAGroupBoxPP : public LGroupBox
  599.     {
  600.     public:
  601.  
  602.         AGAGroupBoxPP();
  603.         AGAGroupBoxPP(LStream* inStream);
  604.         virtual ~AGAGroupBoxPP();
  605.         
  606.         AGAGroupBox*    mAGAObject;
  607.  
  608.         enum { class_ID = 'GCgb' };
  609.         static AGAGroupBoxPP*    CreateStream(LStream* inStream);
  610.  
  611.         // PowerPlant overrides
  612.         virtual void    SetDescriptor(ConstStringPtr inDescriptor);
  613.         virtual void    ResizeFrameBy(Int16 inWidthDelta, Int16 inHeightDelta, Boolean inRefresh);
  614.         virtual void    MoveBy(Int32 inHorizDelta, Int32 inVertDelta, Boolean inRefresh);
  615.  
  616.     protected:
  617.  
  618.         // PowerPlant overrides
  619.         virtual void    FinishCreateSelf();
  620.         virtual void    DrawSelf();
  621.         virtual void    EnableSelf();
  622.         virtual void    DisableSelf();
  623.  
  624.         virtual void    CreateAGAObject();
  625.         
  626.         // Extra AGA object initialization values
  627.         Boolean    mIsPrimaryGroup;
  628.         OSType    mGapPaneID;
  629.     };
  630.  
  631. #pragma mark AGAGroupBoxPPX
  632.  
  633. //
  634. // AGAGroupBoxPPX ----------------------------------------------------
  635. //
  636. // Extended AGAGroupBoxPP class for use with custom pane template.
  637. // The group box type and the gap pane ID are read from the stream.
  638. //
  639.  
  640. class AGAGroupBoxPPX : public AGAGroupBoxPP
  641.     {
  642.     public:
  643.  
  644.         AGAGroupBoxPPX(LStream* inStream);
  645.         virtual ~AGAGroupBoxPPX();
  646.         
  647.         enum { class_ID = 'GXgb' };
  648.         static AGAGroupBoxPPX*    CreateStream(LStream* inStream);
  649.     };
  650.  
  651. #pragma mark AGASecondaryGroupBoxPP
  652.  
  653. //
  654. // AGASecondaryGroupBoxPP ----------------------------------------------------
  655. //
  656. // LGroupBox replacement subclass with secondary group box type.
  657. //
  658.  
  659. class AGASecondaryGroupBoxPP : public AGAGroupBoxPP
  660.     {
  661.     public:
  662.  
  663.         AGASecondaryGroupBoxPP();
  664.         AGASecondaryGroupBoxPP(LStream* inStream);
  665.         virtual ~AGASecondaryGroupBoxPP();
  666.         
  667.         enum { class_ID = 'GCgs' };
  668.         static AGASecondaryGroupBoxPP*    CreateStream(LStream* inStream);
  669.     };
  670.  
  671. #pragma mark AGAScrollBarPP
  672.  
  673. //
  674. // AGAScrollBarPP -------------------------------------------------------
  675. //
  676. // LStdControl/scrollBarProc replacement subclass. To use live scrolling, set the
  677. // AGAScrollBar state directly and either install a notification routine
  678. // or handle the scroll bar's fEventNumber by checking the current value.
  679. // To use proportional indicator, set the AGAScrollBar state directly.
  680. //
  681. // Note that LScroller instantiates its scroll bars for you, so you
  682. // don't need to know about this class when it's being used as part of
  683. // an AGAScrollerPP (LScroller) or AGAActiveScroller (LActiveScroller).
  684. //
  685.  
  686. typedef void (*AGANotifyPPPtr)(LPane* theIndicator, SInt32 dataValue, void* userData);
  687.  
  688. class AGAScrollBarPP : public LStdControl
  689.     {
  690.     public:
  691.  
  692.         AGAScrollBarPP();
  693.         AGAScrollBarPP(LStream* inStream);
  694.         AGAScrollBarPP(const SPaneInfo    &inPaneInfo,
  695.                         MessageT        inValueMessage,
  696.                         Int32            inValue,
  697.                         Int32            inMinValue,
  698.                         Int32            inMaxValue,
  699.                         Int16            inControlKind,
  700.                         ResIDT            inTextTraitsID,
  701.                         Str255            inTitle,
  702.                         Int32            inMacRefCon,
  703.                         Boolean            liveScrolling);
  704.         virtual ~AGAScrollBarPP();
  705.         
  706.         AGAScrollBar*    mAGAObject;
  707.  
  708.         enum { class_ID = 'GCsb' };
  709.         static AGAScrollBarPP*    CreateStream(LStream* inStream);
  710.         
  711.         // PowerPlant overrides
  712.         virtual void    ResizeFrameBy(Int16 inWidthDelta, Int16 inHeightDelta, Boolean inRefresh);
  713.         virtual void    MoveBy(Int32 inHorizDelta, Int32 inVertDelta, Boolean inRefresh);
  714.         virtual void    SetValue(SInt32 inValue);
  715.         virtual void    SetMinValue(SInt32 inMinValue);
  716.         virtual void    SetMaxValue(SInt32 inMaxValue);
  717.         
  718.         virtual void    InstallNotificationRoutine(AGANotifyPPPtr notificationRoutine, void* userData);
  719.         virtual void    HandleNotification(SInt32 dataValue);
  720.         
  721.         AGANotifyPPPtr    mNotificationRoutine;
  722.         void*            mUserData;
  723.         
  724.     protected:
  725.  
  726.         // PowerPlant overrides
  727.         virtual void    FinishCreateSelf();
  728.         virtual void    DrawSelf();
  729.         virtual void    ClickSelf(const SMouseDownEvent    &inMouseDown);
  730.         virtual void    EnableSelf();
  731.         virtual void    DisableSelf();
  732.         virtual void    ShowSelf();
  733.  
  734.         virtual void    CreateAGAObject();
  735.         
  736.         static void RealAGANotifier(AGATrackingIndicator* theIndicator, SInt32 dataValue, void* userData);
  737.         
  738.         Boolean    mInitWithLiveScrolling;
  739.     };
  740.  
  741. #pragma mark AGAScrollerPP
  742.  
  743. //
  744. // AGAScrollerPP ----------------------------------------------------
  745. //
  746. // LScroller replacement subclass that creates AGAScrollBarPP objects
  747. // rather than LStdControl/scrollBarProc objects. The scroll bars are
  748. // initialized with live scrolling turned off.
  749. //
  750. // The ugly part is that there's no single bottleneck for creating
  751. // the scroll bars. MakeScrollBars is declared private, so we cannot
  752. // override that. Basically we have to postprocess each constructor
  753. // and make new scroll bars to replace the old ones.
  754. //
  755.  
  756. class AGAScrollerPP : public LScroller
  757.     {
  758.     public:
  759.  
  760.         AGAScrollerPP();
  761.         AGAScrollerPP(LStream* inStream);
  762.         AGAScrollerPP(LStream* inStream, Boolean liveTracking);
  763.         virtual ~AGAScrollerPP();
  764.         
  765.         enum { class_ID = 'GCsc' };
  766.         static AGAScrollerPP*    CreateStream(LStream* inStream);
  767.  
  768.         virtual void    HandleNotification(LPane* theScrollBar, SInt32 dataValue);
  769.  
  770.     protected:
  771.     
  772.         // PowerPlant overrides
  773.         virtual void    FinishCreateSelf();
  774.         virtual void    AdjustScrollBars();
  775.  
  776.         virtual void    MakeCustomScrollBars(Int16 inHorizBarLeftIndent, Int16 inHorizBarRightIndent, Int16 inVertBarTopIndent, Int16 inVertBarBottomIndent, Boolean liveTracking);
  777.  
  778.         virtual AGAScrollBarPP*    MakeCustomScrollBar(const SPaneInfo& barInfo, Boolean liveTracking);
  779.  
  780.         LStdControl        *mOldVerticalBar;
  781.         LStdControl        *mOldHorizontalBar;
  782.         
  783.         static void ScrollBarNotifier(LPane* theScrollBar, SInt32 dataValue, void* userData);
  784.     };
  785.  
  786. #pragma mark AGAActiveScrollerPP
  787.  
  788. //
  789. // AGAActiveScrollerPP ----------------------------------------------------
  790. //
  791. // LActiveScroller replacement subclass that creates AGAScrollBarPP objects
  792. // rather than LStdControl/scrollBarProc objects. The scroll bars are
  793. // initialized with live scrolling turned on.
  794. //
  795.  
  796. class AGAActiveScrollerPP : public AGAScrollerPP
  797.     {
  798.     public:
  799.  
  800.         AGAActiveScrollerPP();
  801.         AGAActiveScrollerPP(LStream* inStream);
  802.         virtual ~AGAActiveScrollerPP();
  803.         
  804.         enum { class_ID = 'GCas' };
  805.         static AGAActiveScrollerPP*    CreateStream(LStream* inStream);
  806.     };
  807.  
  808. #pragma mark AGASliderPP
  809.  
  810. //
  811. // AGASliderPP -------------------------------------------------------
  812. //
  813. // LControl subclass. To set/get the value, use the LControl value
  814. // methods. The mUserCon is used as the resource ID of an 'STR#' resource
  815. // that contains the slider labels; in this case, the range is
  816. // automatically set to match the number of labels, and the slider
  817. // will have a pointy indicator. If the ID is zero or invalid, the
  818. // slider will be rectangular.
  819. //
  820.  
  821. class AGASliderPP : public LControl
  822.     {
  823.     public:
  824.  
  825.         AGASliderPP();
  826.         AGASliderPP(LStream* inStream);
  827.         virtual ~AGASliderPP();
  828.         
  829.         AGASlider*    mAGAObject;
  830.  
  831.         enum { class_ID = 'GCsl' };
  832.         static AGASliderPP*    CreateStream(LStream* inStream);
  833.         
  834.         // PowerPlant overrides
  835.         virtual void    ResizeFrameBy(Int16 inWidthDelta, Int16 inHeightDelta, Boolean inRefresh);
  836.         virtual void    MoveBy(Int32 inHorizDelta, Int32 inVertDelta, Boolean inRefresh);
  837.         virtual void    SetValue(SInt32 inValue);
  838.         virtual void    SetMinValue(SInt32 inMinValue);
  839.         virtual void    SetMaxValue(SInt32 inMaxValue);
  840.  
  841.         virtual void    InstallNotificationRoutine(AGANotifyPPPtr notificationRoutine, void* userData);
  842.         virtual void    HandleNotification(SInt32 dataValue);
  843.         
  844.         AGANotifyPPPtr    mNotificationRoutine;
  845.         void*            mUserData;
  846.         
  847.     protected:
  848.  
  849.         // PowerPlant overrides
  850.         virtual void    FinishCreateSelf();
  851.         virtual void    DrawSelf();
  852.         virtual void    ClickSelf(const SMouseDownEvent    &inMouseDown);
  853.         virtual void    EnableSelf();
  854.         virtual void    DisableSelf();
  855.         virtual void    HotSpotResult(SInt16 inHotSpot);
  856.  
  857.         virtual void    CreateAGAObject();
  858.         
  859.         static void RealAGANotifier(AGATrackingIndicator* theIndicator, SInt32 dataValue, void* userData);
  860.         
  861.         // Extra AGA object initialization values
  862.         ResIDT    mLabelsResourceID;
  863.         ResIDT    mLabelsTextTraitsID;    // -1 for standard slider labels style
  864.         SInt32    mSliderJustification;    // not used for unlabled sliders
  865.     };
  866.  
  867. #pragma mark AGASliderPPX
  868.  
  869. //
  870. // AGASliderPPX -------------------------------------------------------
  871. //
  872. // Extended AGASliderPP class for use with custom pane template.
  873. // The labels STR# resource ID, text traits ID, and justification
  874. // are read from the stream.
  875. //
  876.  
  877. class AGASliderPPX : public AGASliderPP
  878.     {
  879.     public:
  880.  
  881.         AGASliderPPX(LStream* inStream);
  882.         virtual ~AGASliderPPX();
  883.         
  884.         enum { class_ID = 'GXsl' };
  885.         static AGASliderPPX*    CreateStream(LStream* inStream);
  886.     };
  887.  
  888. #pragma mark AGALittleArrowsPP
  889.  
  890. //
  891. // AGALittleArrowsPP -------------------------------------------------------
  892. //
  893. // LControl subclass. You will need to either install a notification
  894. // routine to respond to arrow tracking, or subclass and override
  895. // the HandleNotification member function. However:
  896. //
  897. // If you simply want to link the little arrows to a number LEditField
  898. // pane, just put the LEditField's pane ID the little arrows pane's
  899. // mUserCon, and the arrows will automatically increment/decrement
  900. // the LEditField view's value, within the value range of the little
  901. // arrows LControl settings.
  902. //
  903.  
  904. class AGALittleArrowsPP : public LControl
  905.     {
  906.     public:
  907.  
  908.         AGALittleArrowsPP();
  909.         AGALittleArrowsPP(LStream* inStream);
  910.         virtual ~AGALittleArrowsPP();
  911.         
  912.         virtual void    InstallNotificationRoutine(AGANotifyPPPtr notificationRoutine, void* userData);
  913.         virtual void    HandleNotification(SInt32 deltaValue);
  914.         
  915.         AGANotifyPPPtr    mNotificationRoutine;
  916.         void*            mUserData;
  917.  
  918.         AGALittleArrows*    mAGAObject;
  919.  
  920.         enum { class_ID = 'GCla' };
  921.         static AGALittleArrowsPP*    CreateStream(LStream* inStream);
  922.  
  923.         // PowerPlant overrides
  924.         virtual void    ResizeFrameBy(Int16 inWidthDelta, Int16 inHeightDelta, Boolean inRefresh);
  925.         virtual void    MoveBy(Int32 inHorizDelta, Int32 inVertDelta, Boolean inRefresh);
  926.         
  927.     protected:
  928.  
  929.         // PowerPlant overrides
  930.         virtual void    FinishCreateSelf();
  931.         virtual void    DrawSelf();
  932.         virtual void    ClickSelf(const SMouseDownEvent    &inMouseDown);
  933.         virtual void    EnableSelf();
  934.         virtual void    DisableSelf();
  935.  
  936.         virtual void    CreateAGAObject();
  937.         
  938.         static void RealAGANotifier(AGALittleArrows* theAGAObject, SInt32 deltaValue, void* userData);
  939.  
  940.         LEditField*    mLinkedNumberText;
  941.         
  942.         // Extra AGA object initialization values
  943.         OSType    mLinkedPaneID;
  944.     };
  945.  
  946. #pragma mark AGALittleArrowsPPX
  947.  
  948. //
  949. // AGALittleArrowsPPX -------------------------------------------------------
  950. //
  951. // Extended AGALittleArrowsPP class for use with custom pane template.
  952. // The linked LEditField pane ID is read from the stream.
  953. //
  954.  
  955. class AGALittleArrowsPPX : public AGALittleArrowsPP
  956.     {
  957.     public:
  958.  
  959.         AGALittleArrowsPPX(LStream* inStream);
  960.         virtual ~AGALittleArrowsPPX();
  961.         
  962.         enum { class_ID = 'GXla' };
  963.         static AGALittleArrowsPPX*    CreateStream(LStream* inStream);
  964.     };
  965.  
  966. #pragma mark AGAPopupMenuPP
  967.  
  968. //
  969. // AGAPopupMenuPP -------------------------------------------------------
  970. //
  971. // LStdPopupMenu replacement subclass that implements an AGA popup menu.
  972. //
  973.  
  974. class AGAPopupMenuPP : public LStdPopupMenu
  975.     {
  976.     public:
  977.  
  978.         AGAPopupMenuPP(LStream* inStream);
  979.         virtual ~AGAPopupMenuPP();
  980.         
  981.         AGAPopupMenu*    mAGAObject;
  982.  
  983.         enum { class_ID = 'GCpo' };
  984.         static AGAPopupMenuPP*    CreateStream(LStream* inStream);
  985.  
  986.         // PowerPlant overrides
  987.         virtual void    ResizeFrameBy(Int16 inWidthDelta, Int16 inHeightDelta, Boolean inRefresh);
  988.         virtual void    MoveBy(Int32 inHorizDelta, Int32 inVertDelta, Boolean inRefresh);
  989.         virtual void    SetValue(SInt32 inValue);
  990.         
  991.     protected:
  992.  
  993.         // PowerPlant overrides
  994.         virtual void    FinishCreateSelf();
  995.         virtual void    DrawSelf();
  996.         virtual void    ClickSelf(const SMouseDownEvent    &inMouseDown);
  997.         virtual void    EnableSelf();
  998.         virtual void    DisableSelf();
  999.         virtual void    ShowSelf();
  1000.  
  1001.         virtual void    CreateAGAObject();
  1002.         
  1003.         SInt32    mStashedTitleVariation;
  1004.         SInt16    mStashedTitleWidth;
  1005.     };
  1006.  
  1007. #pragma mark AGADisclosureTrianglePP
  1008.  
  1009. //
  1010. // AGADisclosureTrianglePP -------------------------------------------------------
  1011. //
  1012. // LControl subclass Set/get the AGADisclosureTriangle state
  1013. // directly. Think of it as a check box -- it's either on or off.
  1014. // The initial on/off value is taken from the LControl value.
  1015. //
  1016.  
  1017. class AGADisclosureTrianglePP : public LControl
  1018.     {
  1019.     public:
  1020.  
  1021.         AGADisclosureTrianglePP();
  1022.         AGADisclosureTrianglePP(LStream* inStream);
  1023.         virtual ~AGADisclosureTrianglePP();
  1024.         
  1025.         AGADisclosureTriangle*    mAGAObject;
  1026.  
  1027.         enum { class_ID = 'GCdt' };
  1028.         static AGADisclosureTrianglePP*    CreateStream(LStream* inStream);
  1029.  
  1030.         // PowerPlant overrides
  1031.         virtual void    ResizeFrameBy(Int16 inWidthDelta, Int16 inHeightDelta, Boolean inRefresh);
  1032.         virtual void    MoveBy(Int32 inHorizDelta, Int32 inVertDelta, Boolean inRefresh);
  1033.         virtual void    SetValue(SInt32 inValue);
  1034.         
  1035.     protected:
  1036.  
  1037.         // PowerPlant overrides
  1038.         virtual void    FinishCreateSelf();
  1039.         virtual void    DrawSelf();
  1040.         virtual void    ClickSelf(const SMouseDownEvent    &inMouseDown);
  1041.         virtual void    EnableSelf();
  1042.         virtual void    DisableSelf();
  1043.         virtual void    HotSpotResult(SInt16 inHotSpot);
  1044.  
  1045.         virtual void    CreateAGAObject();
  1046.     };
  1047.  
  1048. #pragma mark AGAProgressIndicatorPP
  1049.  
  1050. //
  1051. // AGAProgressIndicatorPP -------------------------------------------------------
  1052. //
  1053. // LControl subclass. Use the standard LControl value methods to set the
  1054. // progress indicator range and value. Access the AGAProgressIndicator
  1055. // directly to set the origin value if desired. If you set the min equal
  1056. // to the max, it will be an indeterminate progress indicator; if the
  1057. // mUserCon is non-zero, it will call this->StartAutoAnimate automatically
  1058. // when it is created so that you don't have to start the animation running. 
  1059. //
  1060.  
  1061. class AGAProgressIndicatorPP : public LControl, public LPeriodical
  1062.     {
  1063.     public:
  1064.  
  1065.         AGAProgressIndicatorPP();
  1066.         AGAProgressIndicatorPP(LStream* inStream);
  1067.         virtual ~AGAProgressIndicatorPP();
  1068.         
  1069.         AGAProgressIndicator*    mAGAObject;
  1070.  
  1071.         enum { class_ID = 'GCpr' };
  1072.         static AGAProgressIndicatorPP*    CreateStream(LStream* inStream);
  1073.         
  1074.         // PowerPlant overrides
  1075.         virtual void    ResizeFrameBy(Int16 inWidthDelta, Int16 inHeightDelta, Boolean inRefresh);
  1076.         virtual void    MoveBy(Int32 inHorizDelta, Int32 inVertDelta, Boolean inRefresh);
  1077.         virtual void    SetValue(SInt32 inValue);
  1078.         virtual void    SetMinValue(SInt32 inMinValue);
  1079.         virtual void    SetMaxValue(SInt32 inMaxValue);
  1080.         virtual void    SpendTime(const EventRecord &inMacEvent);
  1081.  
  1082.         // For an indeterminate progress indicator, you can use these functions
  1083.         // to set it running or stop it. It will start the LPeriodical repeating
  1084.         // and do a quantized animate at idle time.
  1085.         void    StartAutoAnimate();
  1086.         void    StopAutoAnimate();
  1087.  
  1088.     protected:
  1089.  
  1090.         // PowerPlant overrides
  1091.         virtual void    FinishCreateSelf();
  1092.         virtual void    DrawSelf();
  1093.  
  1094.         virtual void    CreateAGAObject();
  1095.     };
  1096.  
  1097. #pragma mark AGAWhiteBackgroundAttachmentPP
  1098.  
  1099. //
  1100. // AGAWhiteBackgroundAttachmentPP ----------------------------------------------------
  1101. //
  1102. // An attachment that you should attach to any subview where the window has
  1103. // a gray background but the particular subview needs a white background.
  1104. // Editable text fields and list boxes are the most common examples.
  1105. // AGAEditFieldPP and AGAListBoxPP both add one of these automatically.
  1106. //
  1107.  
  1108. class AGAWhiteBackgroundAttachmentPP : public LAttachment
  1109.     {
  1110.     public:
  1111.  
  1112.         AGAWhiteBackgroundAttachmentPP(MessageT inMessage = msg_DrawOrPrint, Boolean inExecuteHost = true);
  1113.         AGAWhiteBackgroundAttachmentPP(LStream *inStream);
  1114.  
  1115.         enum { class_ID = 'GCwa' };
  1116.         static AGAWhiteBackgroundAttachmentPP*    CreateStream(LStream* inStream);
  1117.         
  1118.         virtual    Boolean    Execute(MessageT inMessage, void *ioParam);
  1119.  
  1120.     protected:
  1121.     
  1122.         Boolean    mIsNotched;
  1123.     };
  1124.  
  1125. #pragma mark AGANotchedWhiteBackgroundAttachmentPP
  1126.  
  1127. //
  1128. // AGANotchedWhiteBackgroundAttachmentPP ----------------------------------------------------
  1129. //
  1130. // An AGAWhiteBackgroundAttachmentPP that accounts for a "notch" in
  1131. // the white background at the bottom right corner such as left by
  1132. // a pair of scroll bars.
  1133. //
  1134.  
  1135. class AGANotchedWhiteBackgroundAttachmentPP : public AGAWhiteBackgroundAttachmentPP
  1136.     {
  1137.     public:
  1138.  
  1139.         AGANotchedWhiteBackgroundAttachmentPP(MessageT inMessage = msg_DrawOrPrint, Boolean inExecuteHost = true);
  1140.         AGANotchedWhiteBackgroundAttachmentPP(LStream *inStream);
  1141.  
  1142.         enum { class_ID = 'GCnw' };
  1143.         static AGANotchedWhiteBackgroundAttachmentPP*    CreateStream(LStream* inStream);
  1144.     };
  1145.  
  1146. #pragma mark AGABorderFrameAttachmentPP
  1147.  
  1148. //
  1149. // AGABorderFrameAttachmentPP ----------------------------------------------------
  1150. //
  1151. // An attachment that you should attach to any subview where the subview
  1152. // needs a "3D" sunken frame around it. Editable text fields and list
  1153. // boxes are the most common examples.
  1154. // AGAEditFieldPP and AGAListBoxPP both add one of these automatically.
  1155. //
  1156.  
  1157. class AGABorderFrameAttachmentPP : public LAttachment
  1158.     {
  1159.     public:
  1160.  
  1161.         AGABorderFrameAttachmentPP(MessageT inMessage = msg_DrawOrPrint, Boolean inExecuteHost = true);
  1162.         AGABorderFrameAttachmentPP(LStream *inStream);
  1163.  
  1164.         enum { class_ID = 'GCba' };
  1165.         static AGABorderFrameAttachmentPP*    CreateStream(LStream* inStream);
  1166.         
  1167.         virtual    Boolean    Execute(MessageT inMessage, void *ioParam);
  1168.  
  1169.     protected:
  1170.     
  1171.         Boolean    mIsNotched;
  1172.     };
  1173.  
  1174. #pragma mark AGANotchedBorderFrameAttachmentPP
  1175.  
  1176. //
  1177. // AGANotchedBorderFrameAttachmentPP ----------------------------------------------------
  1178. //
  1179. // An AGABorderFrameAttachmentPP that accounts for a "notch" in
  1180. // the contour at the bottom right corner such as left by
  1181. // a pair of scroll bars.
  1182. //
  1183.  
  1184. class AGANotchedBorderFrameAttachmentPP : public AGABorderFrameAttachmentPP
  1185.     {
  1186.     public:
  1187.  
  1188.         AGANotchedBorderFrameAttachmentPP(MessageT inMessage = msg_DrawOrPrint, Boolean inExecuteHost = true);
  1189.         AGANotchedBorderFrameAttachmentPP(LStream *inStream);
  1190.  
  1191.         enum { class_ID = 'GCnb' };
  1192.         static AGANotchedBorderFrameAttachmentPP*    CreateStream(LStream* inStream);
  1193.     };
  1194.  
  1195. #pragma mark AGAEditFieldPP
  1196.  
  1197. //
  1198. // AGAEditFieldPP -------------------------------------------------------
  1199. //
  1200. // LEditField subclass that attaches an AGAWhiteBackgroundAttachmentPP
  1201. // and an AGABorderFrameAttachmentPP to itself.
  1202. // It also knows how to draw the disabled text frame in gray color
  1203. // rather than dithered black pattern.
  1204. //
  1205.  
  1206. class AGAEditFieldPP : public LEditField
  1207.     {
  1208.     public:
  1209.  
  1210.         AGAEditFieldPP();
  1211.         AGAEditFieldPP(LStream* inStream);
  1212.         virtual ~AGAEditFieldPP();
  1213.         
  1214.         enum { class_ID = 'GCed' };
  1215.         static AGAEditFieldPP*    CreateStream(LStream* inStream);
  1216.  
  1217.     protected:
  1218.  
  1219.         virtual void    DrawSelf();
  1220.         virtual void    DrawBox();
  1221.  
  1222.         virtual void    DrawEverything();    // DrawSelf and DrawBox just need to draw everything,
  1223.                                             // incl. frame, shadowing, bg, text
  1224.     };
  1225.  
  1226. #pragma mark AGATextEditPP
  1227.  
  1228. //
  1229. // AGATextEditPP -------------------------------------------------------
  1230. //
  1231. // LTextEdit subclass that attaches an AGAWhiteBackgroundAttachmentPP
  1232. // and an AGABorderFrameAttachmentPP to itself.
  1233. //
  1234.  
  1235. class AGATextEditPP : public LTextEdit
  1236.     {
  1237.     public:
  1238.  
  1239.         AGATextEditPP();
  1240.         AGATextEditPP(LStream* inStream);
  1241.         virtual ~AGATextEditPP();
  1242.         
  1243.         enum { class_ID = 'GCte' };
  1244.         static AGATextEditPP*    CreateStream(LStream* inStream);
  1245.         
  1246.     protected:
  1247.  
  1248.         // PowerPlant overrides
  1249.         virtual void    DrawSelf();
  1250.     };
  1251.  
  1252. #pragma mark AGASeparatorPP
  1253.  
  1254. //
  1255. // AGASeparatorPP -------------------------------------------------------
  1256. //
  1257. // LPane subclass that implements an AGA separator.
  1258. //
  1259.  
  1260. class AGASeparatorPP : public LPane
  1261.     {
  1262.     public:
  1263.  
  1264.         AGASeparatorPP();
  1265.         AGASeparatorPP(LStream* inStream);
  1266.         virtual ~AGASeparatorPP();
  1267.         
  1268.         AGASeparator*    mAGAObject;
  1269.  
  1270.         enum { class_ID = 'GCse' };
  1271.         static AGASeparatorPP*    CreateStream(LStream* inStream);
  1272.  
  1273.         // PowerPlant overrides
  1274.         virtual void    ResizeFrameBy(Int16 inWidthDelta, Int16 inHeightDelta, Boolean inRefresh);
  1275.         virtual void    MoveBy(Int32 inHorizDelta, Int32 inVertDelta, Boolean inRefresh);
  1276.         
  1277.     protected:
  1278.  
  1279.         // PowerPlant overrides
  1280.         virtual void    FinishCreateSelf();
  1281.         virtual void    DrawSelf();
  1282.  
  1283.         virtual void    CreateAGAObject();
  1284.     };
  1285.  
  1286. #pragma mark AGACaptionPP
  1287.  
  1288. //
  1289. // AGACaptionPP -------------------------------------------------------
  1290. //
  1291. // LCaption replacement subclass. Erases pane to gray before allowing
  1292. // standard LCaption drawing.
  1293. //
  1294.  
  1295. class AGACaptionPP : public LCaption
  1296.     {
  1297.     public:
  1298.  
  1299.         AGACaptionPP();
  1300.         AGACaptionPP(LStream* inStream);
  1301.         virtual ~AGACaptionPP();
  1302.         
  1303.         enum { class_ID = 'GCca' };
  1304.         static AGACaptionPP*    CreateStream(LStream* inStream);
  1305.         
  1306.     protected:
  1307.  
  1308.         // PowerPlant overrides
  1309.         virtual void    FinishCreateSelf();
  1310.         virtual void    DrawSelf();
  1311.         virtual void    EnableSelf();
  1312.         virtual void    DisableSelf();
  1313.  
  1314.         RGBColor    mEnabledBackgroundColor;
  1315.         RGBColor    mDisabledBackgroundColor;
  1316.     };
  1317.  
  1318. #pragma mark AGAListBoxPP
  1319.  
  1320. //
  1321. // AGAListBoxPP -------------------------------------------------------
  1322. //
  1323. // LListBox replacement subclass that replaces the default LFocusBox
  1324. // with an AGAFocusBoxPP AGA-style focus frame, and attaches an
  1325. // AGAWhiteBackgroundAttachmentPP and an AGABorderFrameAttachmentPP to
  1326. // itself.
  1327. //
  1328.  
  1329. class AGAListBoxPP : public LListBox
  1330.     {
  1331.     public:
  1332.  
  1333.         AGAListBoxPP();
  1334.         AGAListBoxPP(LStream* inStream);
  1335.         virtual ~AGAListBoxPP();
  1336.         
  1337.         enum { class_ID = 'GClb' };
  1338.         static AGAListBoxPP*    CreateStream(LStream* inStream);
  1339.         
  1340.     protected:
  1341.  
  1342.         // PowerPlant overrides
  1343.         virtual void    FinishCreateSelf();
  1344.         virtual void    DrawSelf();
  1345.         virtual void    ActivateSelf();
  1346.         virtual void    DeactivateSelf();
  1347.         virtual void    EnableSelf();
  1348.         virtual void    DisableSelf();
  1349.  
  1350.         enum { kUseUpdateRgn = true, kDontUseUpdateRgn = false };    // for readability
  1351.         virtual void    DrawEverything(Boolean useUpdateRgn);    // DrawSelf, activate/deactivate, enable/disable just
  1352.                                                                 // need to draw everything, incl. frame, shadowing, bg, text
  1353.         
  1354.         Boolean    mNotchedFrame;
  1355.         Boolean    mNotchedFocusBox;
  1356.     };
  1357.  
  1358. #pragma mark AGANotchedListBoxPP
  1359.  
  1360. //
  1361. // AGANotchedListBoxPP -------------------------------------------------------
  1362. //
  1363. // An AGAListBoxPP that draws uses notched border frame and notched
  1364. // target border.
  1365. //
  1366.  
  1367. class AGANotchedListBoxPP : public AGAListBoxPP
  1368.     {
  1369.     public:
  1370.  
  1371.         AGANotchedListBoxPP();
  1372.         AGANotchedListBoxPP(LStream* inStream);
  1373.         virtual ~AGANotchedListBoxPP();
  1374.         
  1375.         enum { class_ID = 'GCnl' };
  1376.         static AGANotchedListBoxPP*    CreateStream(LStream* inStream);
  1377.     };
  1378.  
  1379. #pragma mark AGANotchedFocusListBoxPP
  1380.  
  1381. //
  1382. // AGANotchedFocusListBoxPP -------------------------------------------------------
  1383. //
  1384. // An AGAListBoxPP that draws uses notched border frame and notched
  1385. // target border.
  1386. //
  1387.  
  1388. class AGANotchedFocusListBoxPP : public AGANotchedListBoxPP
  1389.     {
  1390.     public:
  1391.  
  1392.         AGANotchedFocusListBoxPP();
  1393.         AGANotchedFocusListBoxPP(LStream* inStream);
  1394.         virtual ~AGANotchedFocusListBoxPP();
  1395.         
  1396.         enum { class_ID = 'GCnt' };
  1397.         static AGANotchedFocusListBoxPP*    CreateStream(LStream* inStream);
  1398.     };
  1399.  
  1400. #pragma mark AGAFocusBoxPP
  1401.  
  1402. //
  1403. // AGAFocusBoxPP -------------------------------------------------------
  1404. //
  1405. // LFocusBox replacement subclass that implements an AGA focus frame.
  1406. // The AGAListBoxPP class replaces the standard LFocusBox with one of
  1407. // these.
  1408. //
  1409.  
  1410. class AGAFocusBoxPP : public LFocusBox
  1411.     {
  1412.     public:
  1413.  
  1414.         AGAFocusBoxPP();
  1415.         AGAFocusBoxPP(const LFocusBox &inOriginal);
  1416.         AGAFocusBoxPP(LStream* inStream);
  1417.         virtual ~AGAFocusBoxPP();
  1418.         
  1419.         enum { class_ID = 'GCfb' };
  1420.         static AGAFocusBoxPP*    CreateStream(LStream* inStream);
  1421.         
  1422.     protected:
  1423.     
  1424.         // PowerPlant overrides
  1425.         virtual void        DrawSelf();
  1426.         virtual RgnHandle    GetBoxRegion(const Rect &inFrame, const Rect &inRevealed) const;
  1427.         
  1428.         Boolean mIsNotched;
  1429.     };
  1430.  
  1431. #pragma mark AGANotchedFocusBoxPP
  1432.  
  1433. //
  1434. // AGANotchedFocusBoxPP -------------------------------------------------------
  1435. //
  1436. // An AGAFocusBoxPP that accounts for a "notch" in
  1437. // the contour at the bottom right corner such as left by
  1438. // a pair of scroll bars.
  1439. //
  1440.  
  1441. class AGANotchedFocusBoxPP : public AGAFocusBoxPP
  1442.     {
  1443.     public:
  1444.  
  1445.         AGANotchedFocusBoxPP();
  1446.         AGANotchedFocusBoxPP(const LFocusBox &inOriginal);
  1447.         AGANotchedFocusBoxPP(LStream* inStream);
  1448.         virtual ~AGANotchedFocusBoxPP();
  1449.         
  1450.         enum { class_ID = 'GCnf' };
  1451.         static AGANotchedFocusBoxPP*    CreateStream(LStream* inStream);
  1452.     };
  1453.  
  1454. #pragma mark AGATabPanelPP
  1455.  
  1456. //
  1457. // AGAPanelEnclosurePP ----------------------------------------------------
  1458. //
  1459. // LView + LCommander mixin class that should be used as the root view
  1460. // of your individual tab panel PPob resources. It's OK to just use a
  1461. // plain LView, but in that case commander targeting cannot be handled
  1462. // by AGATabPanelPP and may result in less-than-ideal activation of
  1463. // things like edit text fields as you switch between panels.
  1464. //
  1465.  
  1466. class AGAPanelEnclosurePP : public LView, public LCommander
  1467.     {
  1468.     public:
  1469.  
  1470.         AGAPanelEnclosurePP();
  1471.         AGAPanelEnclosurePP(LStream* inStream);
  1472.         virtual ~AGAPanelEnclosurePP();
  1473.         
  1474.         enum { class_ID = 'GCpe' };
  1475.         static AGAPanelEnclosurePP*    CreateStream(LStream* inStream);
  1476.     
  1477.         virtual void    SwitchPanelOut();
  1478.         virtual void    SwitchPanelIn();
  1479.     };
  1480.  
  1481. //
  1482. // AGATabPanelPP ----------------------------------------------------
  1483. //
  1484. // LView subclass for AGATabPanel set for large tabs. When instantiated
  1485. // from a view resource, the mUserCon, if non-zero, is used as the resource
  1486. // ID of an 'STR#' resource that contains the tab labels; the number of
  1487. // tabs will be the number of strings in the 'STR#' resource. If you have
  1488. // existing tabs, such as via the 'STR#', use InstallPanel to assign a
  1489. // panel to a tab. If you have no tabs yet, use AddPanel to create a new
  1490. // tab for a panel. Note that the panel views must be non-window 'PPob'
  1491. // resources, i.e. view hierarchies with an LView at the root, not an LWindow.
  1492. //
  1493.  
  1494. class AGATabPanelPP : public LView
  1495.     {
  1496.     public:
  1497.  
  1498.         AGATabPanelPP();
  1499.         AGATabPanelPP(LStream* inStream);
  1500.         virtual ~AGATabPanelPP();
  1501.         
  1502.         AGATabPanel*    mAGAObject;
  1503.  
  1504.         enum { class_ID = 'GCtp' };
  1505.         static AGATabPanelPP*    CreateStream(LStream* inStream);
  1506.         
  1507.         // PowerPlant overrides
  1508.         virtual void    ResizeFrameBy(Int16 inWidthDelta, Int16 inHeightDelta, Boolean inRefresh);
  1509.         virtual void    MoveBy(Int32 inHorizDelta, Int32 inVertDelta, Boolean inRefresh);
  1510.         virtual void    SetValue(SInt32 inValue);
  1511.         virtual SInt32    GetValue() const;
  1512.         virtual void    Disable();
  1513.         
  1514.         // HandleTabSwitch can be used to switch to the specified panel,
  1515.         // but it will call ValidatePanel before allowing the switch.
  1516.         // This is what ClickSelf does to handle a click in a tab.
  1517.         // To switch directly without validation, just call SetValue.
  1518.         virtual void    HandleTabSwitch(SInt32 newTabIndex);
  1519.         
  1520.         // AddPanel adds another tab, and assigns it the specified 'PPob' view.
  1521.         // If the specified label StringPtr is NULL, the 'PPob' rsrc name is used.
  1522.         virtual void    AddPanel(ResIDT panelResourceID,
  1523.                                 StringPtr tabLabel);
  1524.  
  1525.         // InstallPanel assigns the specified 'PPob' view to the specified
  1526.         // existing tab. If the specified label StringPtr is NULL, the existing
  1527.         // tab label is left untouched.
  1528.         virtual void    InstallPanel(SInt32 tabIndex,
  1529.                                 ResIDT panelResourceID,
  1530.                                 StringPtr tabLabel);
  1531.  
  1532.         // GetPanelView returns the LView pointer to the root of the
  1533.         // pane hierarchy of the specified tab.
  1534.         virtual LView*    GetPanelView(SInt32 tabIndex);
  1535.  
  1536.     protected:
  1537.  
  1538.         // PowerPlant overrides
  1539.         virtual void    FinishCreateSelf();
  1540.         virtual void    DrawSelf();
  1541.         virtual void    ClickSelf(const SMouseDownEvent    &inMouseDown);
  1542.         virtual void    EnableSelf();
  1543.         virtual void    DisableSelf();
  1544.  
  1545.         virtual void    CreateAGAObject();
  1546.         virtual void    CreateContainerView();
  1547.  
  1548.         // Override ValidatePanel if you need to perform validation
  1549.         // before allowing the user to switch panels.
  1550.         virtual Boolean    ValidatePanel(SInt32 currentTabIndex);
  1551.  
  1552.         virtual void    SwitchPanels(SInt32 newTabIndex);
  1553.         virtual void    SwitchPanelOut();
  1554.         virtual void    SwitchPanelIn(SInt32 newTabIndex);
  1555.         
  1556.         SInt16    mLabelsResourceID;
  1557.         ResIDT    mLabelsTextTraitsID;
  1558.         
  1559.         LView*    mPanelContainerView;
  1560.         LView*    mActivePanelView;
  1561.         
  1562.         Boolean    mTempSupressDisable;    // workaround -- see Disable() method
  1563.     };
  1564.  
  1565. #pragma mark AGATabPanelPPX
  1566.  
  1567. //
  1568. // AGATabPanelPPX ----------------------------------------------------
  1569. //
  1570. // Extended AGATabPanelPP class for use with custom pane template.
  1571. // The labels STR# resource ID and text traits ID are read from the stream.
  1572. // The AGA standard for small tabs is Geneva 10pt bold.
  1573. // If you use a font size greater than 10, the tabs will be "large".
  1574. // If you use a font size of 10 or less, the tabs will be "small".
  1575. //
  1576.  
  1577. class AGATabPanelPPX : public AGATabPanelPP
  1578.     {
  1579.     public:
  1580.  
  1581.         AGATabPanelPPX(LStream* inStream);
  1582.         virtual ~AGATabPanelPPX();
  1583.  
  1584.         enum { class_ID = 'GXtp' };
  1585.         static AGATabPanelPPX*    CreateStream(LStream* inStream);
  1586.     };
  1587.  
  1588. #pragma mark AGASmallTabPanelPP
  1589.  
  1590. //
  1591. // AGASmallTabPanelPP ----------------------------------------------------
  1592. //
  1593. // AGATabPanelPP subclass that implements folder tabs, set for "small"
  1594. // tab appearance.
  1595. //
  1596.  
  1597. class AGASmallTabPanelPP : public AGATabPanelPP
  1598.     {
  1599.     public:
  1600.  
  1601.         AGASmallTabPanelPP(LStream* inStream);
  1602.         virtual ~AGASmallTabPanelPP();
  1603.  
  1604.         enum { class_ID = 'GCts' };
  1605.         static AGASmallTabPanelPP*    CreateStream(LStream* inStream);
  1606.     
  1607.     protected:
  1608.  
  1609.         // After creating the object we set the tab size and text style
  1610.         // to the standard small appearance.
  1611.         virtual void    CreateAGAObject();
  1612.  
  1613.     };
  1614.  
  1615. #endif // __GRAYCOUNCILPP__
  1616.  
  1617.